package com.ceshiren.hogwarts.app;

import com.sun.javafx.image.ByteToBytePixelConverter;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.net.URL;
import java.util.concurrent.TimeUnit;

public class ContactPage extends BasePage{


    public ContactPage(AndroidDriver androidDriver) {
        super(androidDriver);
    }

    public void addMember(String name,String sex,String mobile){
        //点击右上角进入添加成员
        click(By.id("com.tencent.wework:id/i6i"));
        //点击添加成员
        click(By.id("com.tencent.wework:id/e30"));
        //点击手动输入
        click(By.xpath("//*[@text='手动输入添加']"));
        //输入姓名
        sendKeys(By.id("com.tencent.wework:id/b4t"),name);
        //点击箭头
        click(By.id("com.tencent.wework:id/b55"));
        //点击性别
        click(By.xpath("//*[@text='"+sex+"']"));
        //输入电话号码
        sendKeys(By.id("com.tencent.wework:id/fow"),mobile);
        //保存
        click(By.id("com.tencent.wework:id/i6k"));

    }

    public String searchContent(String name){
        //点击放大镜
        click(By.id("com.tencent.wework:id/i6n"));
        click(By.xpath("//*[@text='搜索']"));
        sendKeys(By.id("com.tencent.wework:id/gpg"),name);
        return androidDriver.findElement(By.id("com.tencent.wework:id/e6d")).getText();
    }

}
